Skip to content

feat: resize panes from the keyboard with pane.resize - #1087

Open
darkwebber wants to merge 1 commit into
herdrdev:masterfrom
darkwebber:feat/pane-resize
Open

darkwebber wants to merge 1 commit into
herdrdev:masterfrom
darkwebber:feat/pane-resize

Conversation

@darkwebber

Copy link
Copy Markdown

Splits can only be resized by dragging the divider. Keyboard resize (tmux's resize-pane, the herdr TUI's resize mode) can't be built as a mod, because no command changes a split's sizes.

What it does

  • pane.resize {direction, pane?, px?} moves the border nearest the pane along that axis by px (default 40). It sets up the same Drag the divider uses and calls drag_to, so min/max, px and weight children, zoom and saving behave exactly like a mouse drag.
  • The border moves in the direction given, whichever side of it the pane is on (tmux's behaviour). If nothing is split that way, or the tab is zoomed, it's a no-op.
  • Documented in defaults/AGENTS.md, herdr.d.ts and docs/commands.md.

Before growing the core

  1. The app acts on it: it changes the tab's split sizes.
  2. Only the app has the split tree and its bounds.
  3. A mod can't do it: there's no command that changes sizes.

Testing

  • cargo test --locked passes; bun scripts/docs.ts generate leaves no changes.
  • New window::tests::panes_resize_from_the_keyboard covers direction validation, the no-op and an unknown pane. Moving a real divider needs laid-out bounds, so I checked that by hand on macOS: a 120px move left then 200px right moved the divider 240 and 400 device px.

🤖 Generated with Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant